home *** CD-ROM | disk | FTP | other *** search
/ Canada a National History / Canada - A National History.iso / mac / CommonStyleSheets / menu.js < prev    next >
Text File  |  2006-02-24  |  2KB  |  47 lines

  1. //--- Create menu array. ---//
  2.  
  3. var cell = new Array(8) 
  4.  
  5. //--- Stuff menu array entries with objects. ---// 
  6. //--- URL, ImageName, Alt  --//
  7.  
  8. cell[0] = new Array("", "", "")
  9. cell[1] = new Array("Start", "Home", "Home")
  10. cell[2] = new Array("pSource", "pSource", "Primary Source Documents Library")
  11. cell[3] = new Array("sReadings", "sReadings", "Suggested Readings")
  12. cell[4] = new Array("webLinks", "webLinks", "Weblinks")
  13. cell[5] = new Array("help", "Help", "Help")
  14.  
  15.  
  16. function LeftMenu(active) {
  17.     for(var i=1; i<=5; i++)    {
  18.     
  19.     if (i != active) {
  20.  
  21.             document.write('<A HREF="' + cell[i][0] + '.html" onMouseOver="SwapImage(this,\'im' + i + '\',\'images/icons/' + cell[i][1] + '_over.gif\')">');
  22.             document.write('<IMG NAME="im' + i + '" SRC="images/icons/' + cell[i][1] + '_up.gif"  Border="0" ALT="' + cell[i][2] + '"></A><BR>');
  23.  
  24.             } else {
  25.     
  26.             document.write('<IMG SRC="images/icons/' + cell[i][1] + '_act.gif"  BORDER="0" ALT="' + cell[i][2] + '"><BR>');
  27.  
  28.             }
  29.         }
  30.     }
  31.  
  32.  
  33. //--- Rollover function. ---// 
  34.  
  35.  
  36. function SwapImage(id,ident,RollOverImage) {
  37.   if(document.images) {
  38.     image            = document.images[ident];
  39.     image.MouseOutImage      = new Image();
  40.     image.RollOverImage     = new Image();
  41.     image.MouseOutImage.src  = document.images[ident].src;
  42.     image.RollOverImage.src = RollOverImage;
  43.     image.src        =image.RollOverImage.src;
  44.     id.onmouseout  = new Function("var image=document."+ident+"; image.src=image.MouseOutImage.src;");
  45.     id.onmouseover = new Function("var image=document."+ident+"; image.src=image.RollOverImage.src;");
  46.   }
  47. }